$OpenBSD: patch-lib_binrpc_binrpc_api_c,v 1.2 2015/11/20 10:09:52 sthen Exp $
--- lib/binrpc/binrpc_api.c.orig	Fri Oct  2 15:35:17 2015
+++ lib/binrpc/binrpc_api.c	Mon Oct 19 14:00:40 2015
@@ -138,10 +138,10 @@ static int connect_unix_sock(char* name, int type, str
 	s=-1;
 	memset(&ifsun, 0, sizeof (struct sockaddr_un));
 	len=strlen(name);
-	if (len>UNIX_PATH_MAX){
+	if (len>sizeof(ifsun.sun_path)){
 		snprintf(binrpc_last_errs, sizeof(binrpc_last_errs)-1, 
 				"connect_unix_sock: name too long "
-				"(%d > %d): %s", len, UNIX_PATH_MAX, name);
+				"(%d > %ld): %s", len, sizeof(ifsun.sun_path), name);
 		goto error;
 	}
 	ifsun.sun_family=AF_UNIX;
@@ -163,16 +163,16 @@ static int connect_unix_sock(char* name, int type, str
 			if (sock_dir==0)
 				sock_dir="/tmp";
 retry:
-			ret=snprintf(mysun->sun_path, UNIX_PATH_MAX, "%s/" NAME "_%d",
+			ret=snprintf(mysun->sun_path, sizeof(mysun->sun_path), "%s/" NAME "_%d",
 							sock_dir, rand()); 
-			if ((ret<0) ||(ret>=UNIX_PATH_MAX)){
+			if ((ret<0) ||(ret>=sizeof(mysun->sun_path))){
 				snprintf(binrpc_last_errs, sizeof(binrpc_last_errs)-1, 
 							"connect_unix_sock: buffer overflow while trying to"
 							"generate unix datagram socket name");
 				goto error;
 			}
 		}else{
-			if (strlen(reply_socket)>UNIX_PATH_MAX){
+			if (strlen(reply_socket)>sizeof(mysun->sun_path)){
 				snprintf(binrpc_last_errs, sizeof(binrpc_last_errs)-1, 
 							"connect_unix_sock: buffer overflow while trying to"
 							"use the provided unix datagram socket name (%s)",
